<?php

$rating_id = get_input('rating_id');

$rating    = get_interest_rating_history($rating_id);
$interest  = get_interest($rating->object_id);

$return = array();

$temp_object = array();
$temp_object['rating_id'] = $rating_id;
$temp_object['guid'] = $interest->id;
$temp_object['name'] = $interest->name;
$photo = get_photo_url($interest->id);
$temp_object['image_url'] = $photo->url;

if($rating->rating == 0)
    $temp_object['rating'] = 'dislikes';
else if($rating->rating == 2)
    $temp_object['rating'] = 'likes';
else if($rating->rating == -1)
    $temp_object['rating'] = 'feels neutral to';

$_userObject = get_user($rating->user_id);

$temp_object['interest'] = to_interest_array($interest);
$temp_object['rating_obj'] = to_rating_history_array($rating);
$temp_object['user_obj'] = userToArray($_userObject, 'opinions', FALSE);
$return[] = $temp_object;

echo json_encode(export_result(200, $return));

?>